import request from '@/config/axios'

/** 标签信息 */
export interface Tag {
          id: number; // 标签ID
          title?: string; // 标签标题
          content?: string; // 标签内容
  }

// 标签 API
export const TagApi = {
  // 查询标签分页
  getTagPage: async (params: any) => {
    return await request.get({ url: `/business/tag/page`, params })
  },

  // 查询标签树
  getTagTree: async () => {
    return await request.get({ url: `/business/tag/tree` })
  },

  // 查询标签详情
  getTag: async (id: number) => {
    return await request.get({ url: `/business/tag/get?id=` + id })
  },

  // 新增标签
  createTag: async (data: Tag) => {
    return await request.post({ url: `/business/tag/create`, data })
  },

  // 修改标签
  updateTag: async (data: Tag) => {
    return await request.put({ url: `/business/tag/update`, data })
  },

  // 删除标签
  deleteTag: async (id: number) => {
    return await request.delete({ url: `/business/tag/delete?id=` + id })
  },

  /** 批量删除标签 */
  deleteTagList: async (ids: number[]) => {
    return await request.delete({ url: `/business/tag/delete-list?ids=${ids.join(',')}` })
  },

  // 导出标签 Excel
  exportTag: async (params) => {
    return await request.download({ url: `/business/tag/export-excel`, params })
  },
}
